package com.design.patterns.list.adapter;

import com.design.patterns.list.adapter.classadapter.Phone;
import com.design.patterns.list.adapter.classadapter.VoltageAdapter;
import com.design.patterns.list.adapter.interfaceadapter.AbstractAdapter;
import com.design.patterns.list.adapter.objectadapter.Voltage220V;

/**
 * @author Wangzhiwen
 */
public class Client {

    private static void classAdapter(){
        Phone phone = new Phone();
        phone.charging(new VoltageAdapter());
    }

    private static void objectAdapter(){
        com.design.patterns.list.adapter.objectadapter.Phone phone = new com.design.patterns.list.adapter.objectadapter.Phone();
        phone.charging(new com.design.patterns.list.adapter.objectadapter.VoltageAdapter(new Voltage220V()));
    }

    private static void interfaceAdapter(){
        com.design.patterns.list.adapter.interfaceadapter.Phone phone = new com.design.patterns.list.adapter.interfaceadapter.Phone();
        phone.charging(new AbstractAdapter(){
            @Override
            public int out5V() {
                return 5;
            }
        });
    }

    public static void main(String[] args) {

        classAdapter();

        objectAdapter();

        interfaceAdapter();
    }

}
